<?php

use App\Http\Admin\AuthController;
use Illuminate\Routing\Router;
use Illuminate\Support\Facades\Route;

$domain = config('config.admin_domain');

$namespace = '\\App\\Http\\Admin';
Route::domain($domain)->namespace($namespace)->group(function () {

    Route::group([], function (Router $router) {
        $router->get('auth/menus', [AuthController::class, 'menus']); // menus
        $router->post('auth/login', [AuthController::class, 'login']); // 登录
    });

    Route::group([
        'middleware' => ['jwt:api', 'scope:admin'] // scope角色认证，开启需要支持LibAuthService
    ], function (Router $router) {
        Route::group([
            'prefix' => 'auth'
        ], function (Router $router) {
            $router->get('logout', [AuthController::class, 'logout']); // 退出
        });
    });
});
